package com.gskj.educenter.utils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author :CodingFarmer_码农  Connor(康纳)_郭
 * @date : 08:10 20.5.22
 * @Company : http://www.gskj.com
 * @Version : 1.0
 * <p>
 * 获取 配置文件中 微信信息的工具类
 */
@Component
@Slf4j
public class WechatPropUtils implements InitializingBean {

    @Value("${wx.open.app_id}")
    private String appId;

    @Value("${wx.open.app_secret}")
    private String appSecret;

    @Value("${wx.open.redirect_url}")
    private String redirectUrl;

    public static String WX_OPEN_APP_ID;
    public static String WX_OPEN_APP_SECRET;
    public static String WX_OPEN_REDIRECT_URL;

    @Override
    public void afterPropertiesSet() throws Exception {

        log.info(appId);
        log.info(appSecret);
        log.info(redirectUrl);

        this.WX_OPEN_APP_ID = this.appId;
        this.WX_OPEN_APP_SECRET = this.appSecret;
        this.WX_OPEN_REDIRECT_URL = this.redirectUrl;
    }
}
